# $Id: Makefile.in 864 2007-08-09 14:24:33Z mremond $

CC = gcc
CFLAGS = -g -O2 -I/usr/lib/erlang/lib/erl_interface-3.5.5.3/include -I/usr/lib/erlang/usr/include
CPPFLAGS = -I/usr/local/ssl/lib 
LDFLAGS = 
LIBS =  -L/usr/lib/erlang/lib/erl_interface-3.5.5.3/lib -lerl_interface -lei

ifeq ($(shell uname),Darwin)
DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress
else
# Assume Linux-style dynamic library flags
DYNAMIC_LIB_CFLAGS = -fpic -shared
endif

SUBDIRS = 

ERLSHLIBS = ../stringprep_drv.so

OUTDIR = ..
EFLAGS = -I .. -pz ..
OBJS   = \
	$(OUTDIR)/stringprep.beam \
	$(OUTDIR)/stringprep_sup.beam

all:    $(OBJS) $(ERLSHLIBS)

$(OUTDIR)/%.beam:       %.erl
	/usr/bin/erlc -W $(EFLAGS) -o $(OUTDIR) $<

#all:	$(ERLSHLIBS)
#	erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt

$(ERLSHLIBS):	../%.so:	%.c uni_data.c uni_norm.c
			gcc -Wall -O2 $(CFLAGS) $(LDFLAGS) $(INCLUDES) \
			$(subst ../,,$(subst .so,.c,$@)) $(LIBS) \
			-o $@ $(DYNAMIC_LIB_CFLAGS)

clean:
	rm -f $(OBJS) $(ERLSHLIBS)

distclean: clean
	rm -f Makefile

TAGS:
	etags *.erl

